USB Remote
Background For several years, CHDK has provided a simple method of operating a Canon P&S camera from a remote USB port connected device. Built-in functionality allowed remote replication of basic "press half" and "press full" actions on the shutter button. The ability to synchronize the release of the shutter between multiple camera connected to a common control unit was implemented. There was also a limited remote zoom functionality, usefull for coordinating the zoom position when many cameras were connected together. With the passing of time, the code base supporting this functionality had become increasingly complicated and difficult to maintain or extend. To that end, starting with CHDK svn version 15xx a new set of functionality has been released. This new version provides a more stable and easy to understand interface and considerably expanded build in functionality. The "stable" release branch of CHDK designated 1.0 continues to include the older implementation. Introduction CHDK version 2 USB remote code introduce a modular concept for the selection of what device is connected to the camera and how the camera reacts to that device. >> chdk usb 2 functional block diagram << The operation of devices connected to the USB port is converted to one the following states: *switch released *switch half pressed *switch full pressed or they produce a value indicating number of activations (pulse count) or they produce a value indicating of the duration the activation (pulse width / pulse gap). Supported Hardware CHDK now supports the use of several different remote control devices to control a set of camera shooting functions. For basic shooting functions, a simple switch can be used to provide 5V to the USB connector power pins. Details about how to build such a device can be found here : USB_Remote_Cable Note that software functionality described on that page refers to CHDK stable release 1.0 In addition to "home made" devices, a commercial product called a Ricoh CA-1 can also be used. These are widely available at camera stores or online from many sources. For more complex operations, devices that produce multiple pulses or pulses of different time duration (width) can be used. This functionality can often be emulated with a simple switch as well. Enabling USB Remote operation To enable USB remote operation, go to the CHDK Remote parameters menu and select Enable Remote. When this option is selected, the USB port on the camera will no longer be available for uploading picture files or ptp operations. Switch Types None Default setting at start-up. Indicates that no USB device is to be monitored. Useful when a script will be interacting with the USB port. OnePush Used with simple switch inputs. Pressing the switch initiates a "half-press" state. Releasing the switch initiates a "full-press" state for 100 mSec. There is no mechanism to cancel a "half-press" once this sequence is started. TwoPush Used with simple switch inputs. Pressing the switch initiates a "half-press" state. Releasing the switch and then immediately pressing the again switch in less than 1/2 second initiates a "full-press" s tate. Full press state continues while the switch is held. Failing to immediately press the switch the second time will cancel the sequence. CA-1 Used with a Ricoh CA-1 switch device. Half pressing the button causes the CA-1 to create a 30 mSec pulse that initiates a "half press" state. Releasing the switch at that point will generate 2x30 mSec pulses that cancel the shooting sequences. Full pressing the button will create a 150 mSec pulse that will initiate a "full press" state for 100 mSec. P.Width Used with devices that communicate information by changing the amount of time that the USB 5V signal is applied. Can be generate using a simple switch but more typically from a microcontroller type electronic device ( Gentilles USB xxx ). Typically this information is interpreted by a Lua or uBasic script. P.Count Used with devices that cycle the USB 5V power on & off one or more times within a predetermined period of time. Can be generate using a simple switch but more typically from a microcontroller type electronic device. Control Modes CHDK control modes support the translation of input device activation sequences into specific camera opersions. None Does nothing - default value. >> screen shot 8 Normal half press - full press >> screen shot 9 diagram 7 ( sync action = ) Quick full press ( sync action = none) >> screen shot 10 diagram 8 Burst full press to start - full press to stop ( sync action = ) >> screen shot 11 diagram 9 Bracket changes eV on each press ( sync action = ) >> screen shot 12 diagram 10 Zoom used with pulse count mode - 1 press = zoom in 2 press = zoom out, 3 press = full press 4 press = shoot ( sync action = ) 5 press = full zoom out 6 press = full zoom in >> screen shot 13 diagram 14 ( sync action = ) Video start on full press, stop on full press >> screen shot 13 diagram 14 gentWIRE Works with pulse width input mode and the http://www.gentles.ltd.uk/gentwire/usb.htm gentwireUSB2 Script enables input device to process even in mode (read via wait_click and is_key) - make it easier to use the CA-1 interchangable with one press & two press buttons. Multicamera Syncronization Scripting Interface With the release of the new USB remote functionality the get_usb_power() function has been extended to include new functionality. The basic functionality provided by get_usb_power and is_key "remote" continues to be support. while 1 wait_click 1 if is_key "remote" then shoot wend end waits for a USB power to be applied and then takes some action (e.g. shoot) do p = get_usb_power until p>0 waits for a USB power on / off action and returns the lenght of pulse application In addition, it is also possible to return the most recent count of pulses received and a buffered list of pulse width and pulse gap information : do p = get_usb_pulse_count until p>0 returns the most recent number of pulses in a window (terminates after 1 second of inactivity) do p = get_pulse_widht until p>0 returns a buffered pulse width or pulse gap value (width values are positive, gap values are negative)